from selenium import webdriver
from selenium.webdriver.common.by import By

from selenium_po_practice.Pages.base_page import BasePage

# 继承BasePage模块
from selenium_po_practice.Pages.contact_page import ContactPage
from selenium_po_practice.Pages.member_adding_page import MemberAddingPage


class MainPage(BasePage):
    def goto_add_member(self):
        """
        点击添加成员，跳转到成员添加页面
        :return: 成员添加页面实例对象
        """

        # driver = webdriver.Chrome()
        # driver.get(base_url)

        # 点击添加成员
        self.driver.find_element(By.CSS_SELECTOR, ".ww_indexImg_AddMember").click()
        # 返回添加成员页面实例对象，将参数self.driver传入以保证是同一个session驱动
        return MemberAddingPage(self.driver)

    def goto_contact(self):
        return ContactPage(self.driver)
